﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class CMS_Control_Version : System.Web.UI.UserControl
{
    Usas.BLL.Cms.cmsArticle ar = new Usas.BLL.Cms.cmsArticle();

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public void GetValue(string pid,bool IsControl)
    {
        DataSet ds = ar.GetList(" IsVersion='1' and ParentArtId=" + pid);
        if (ds != null)
        {
            DataTable dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    HyperLink hy = new HyperLink();

                    //hy.NavigateUrl = "~/CMS/Version.aspx.aspx?id=" + dt.Rows[i]["ArtId"].ToString();

                    if (IsControl)
                    {
                        hy.Attributes.Add("onclick", "window.open ('../Version.aspx?id=" + dt.Rows[i]["ArtId"].ToString() + "', '历史版本', 'height=600px, width=750px, toolbar=no, menubar=no, scrollbars=yes,status=no,top=200,left=100');return false;");
                    }
                    else
                    {
                        hy.Attributes.Add("onclick", "window.open ('Version.aspx?id=" + dt.Rows[i]["ArtId"].ToString() + "', '历史版本', 'height=600px, width=750px, toolbar=no, menubar=no, scrollbars=yes,status=no,top=200,left=100');return false;");
                    }
                    hy.NavigateUrl = "javascript:void(0)";

                    hy.CssClass = "vlink";

                    hy.Text = dt.Rows[i]["ArtTopic"].ToString() + "(" + Convert.ToDateTime(dt.Rows[i]["ModfiyTime"]).ToString("yyyy-MM-dd") + ")";
                    DMore.Controls.Add(hy);


                    Literal l = new Literal();
                    l.Text = "<br/>";
                    DMore.Controls.Add(l);
                }
            }
            else
            {
                DMore.InnerHtml = "没有历史版本";
            }
        }
        /*
        V.Attributes.Add("style", "overflow-y:scroll; height:20px;");
        V.Attributes.Add("class", "Sor");
         */
    }
}
